<?php
namespace App\Module\Admin\Request\Activity;

use Hyperf\Validation\Request\FormRequest;

class CreateRequest extends FormRequest{

    public function authorize(): bool
    {
        return true;
    }

    public function rules(): array
    {
        return [
            'act_name'=>'required',
            'type'=>'required|integer|in:1,2,3',
            'type_content'=>"required|array",
            'type_content.start_time'=>'required|date_format:Y-m-d H:i:s',
            'type_content.max'=>'required_if:type,1,2|integer',
            'type_content.end_time'=>'required_if:type,2,3|date_format:Y-m-d H:i:s',
            'fee'=>"required|numeric",
            'score'=>'required|in:1,2',
            'score_content'=>"required_if:score,2|array",
            'score_content.max'=>'required_if:score,2|integer',
            'score_content.rate'=>'required_if:score,2|integer',
            'people_range'=>'required',
            'address'=>'required',
            'thumbnail'=>'required|url',
            'introduce'=>'required',
            'share_content'=>'required|array',
            'share_content.join'=>"integer",
            'share_content.see'=>'integer',
            'resources'=>'required|array',
            'resources.*'=>"url"
        ];
    }
}